SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].gspRating_SEARCH
(
@ratingId int = null,
@productId int = null,
@commentId int = null,
@ratingValue int = null,
@createdDate datetime = null,
@lastModifiedDate datetime = null,
@isDeleted bit = null
)
AS

SELECT
  *
FROM
  [dbo].[Rating]
WHERE
  (@ratingId IS NULL OR [RatingId] = @ratingId)
AND
  (@productId IS NULL OR [ProductId] = @productId)
AND
  (@commentId IS NULL OR [CommentId] = @commentId)
AND
  (@ratingValue IS NULL OR [RatingValue] = @ratingValue)
AND
  (@createdDate IS NULL OR [CreatedDate] = @createdDate)
AND
  (@lastModifiedDate IS NULL OR [LastModifiedDate] = @lastModifiedDate)
AND
  (@isDeleted IS NULL OR [IsDeleted] = @isDeleted)


GO
